package com.example.demo;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Builder;
import lombok.Data;
import lombok.Singular;
import lombok.With;
import lombok.extern.jackson.Jacksonized;

import java.util.List;
import java.util.Map;

@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
@Data
@Builder
@Jacksonized
@With
public class AdsReportingRequest {
    @Singular
    List<RequestQuery> queries;
}

@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
//在 Lombok 中，@Builder(toBuilder = true) 注解的作用是为被注解的类生成一个 toBuilder() 方法，该方法可以基于已有对象创建一个新的 Builder 实例，并复制原有对象的所有属性值。
@Builder(toBuilder = true)
@Jacksonized
@With
class RequestQuery {

    String queryName;

    String dateFrom;

    String dateTo;

    Integer pace;

    int offset;

    Integer limit = 500;

    @Singular
    Map<String, Object> fields;

}
